package com.cyyz.tai.model;

import jakarta.persistence.Access;
import jakarta.persistence.AccessType;
import jakarta.persistence.Column;
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import jakarta.persistence.Temporal;
import jakarta.persistence.TemporalType;
import jakarta.persistence.Transient;

import java.util.Date;

/**
 * 设备地图坐标点
 */
// 为什么这个类，在其他的包中，就扫描不到呢？如果实体类和spring boot主类包不在一个包路径下，需要使用@EntityScan配置扫描的包路径
// Unable to locate persister: com.cyyz.tai.model.DashPoint
// 现在改为使用在get方法上注解，和protobuf区分开。否则transient注解有冲突 20250616
// 更改之后，pageSize等有值，构造where条件，是有问题的，20250616.影响原来的功能实现
@Entity
@Access(AccessType.PROPERTY)
public class DashPoint {
    @Transient
    private Integer page;
    @Transient
    private int pageSize = 10;
    private transient String orderClause; // 影响protobuf
    private transient Integer start;
    @Transient // 影响hibernate。已经改为get方法上标注。字段上可以不添加
    private String orderBy;

    private String id;

    private String label;

    private String lon;

    private String lat;

    private String gx;

    private String xj;

    private String deviceType;

    private Date createDate;

    private String comments;

    private Integer states;
    // 测试添加两个字段，但是没有@Column的注解，是什么效果
    // hibernate 默认处理所有未被@Column注解的字段
    // 3种方法一是使用@Transient注解或关键字。二是使用xml映射。三是使用自定义命名策略。忽略没有注解的字段
    // @Tag(1)
    // private Integer index;
    // @Tag(2)
    // private Integer pageNo;
    @Id
    @Column
    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
    @Column
    public String getLabel() {
        return label;
    }

    public void setLabel(String label) {
        this.label = label;
    }
    @Column
    public String getLon() {
        return lon;
    }

    public void setLon(String lon) {
        this.lon = lon;
    }
    @Column
    public String getLat() {
        return lat;
    }

    public void setLat(String lat) {
        this.lat = lat;
    }
    @Column
    public String getGx() {
        return gx;
    }

    public void setGx(String gx) {
        this.gx = gx;
    }
    @Column
    public String getXj() {
        return xj;
    }

    public void setXj(String xj) {
        this.xj = xj;
    }
    @Column
    @Temporal(TemporalType.TIMESTAMP)
    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }
    @Column
    public String getComments() {
        return comments;
    }

    public void setComments(String comments) {
        this.comments = comments;
    }
    @Column
    public Integer getStates() {
        return states;
    }

    public void setStates(Integer states) {
        this.states = states;
    }
    @Column
    public String getDeviceType() {
        return deviceType;
    }

    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }

    @Transient
    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    @Transient
    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    @Transient
    public String getOrderClause() {
        return orderClause;
    }

    public void setOrderClause(String orderClause) {
        this.orderClause = orderClause;
    }

    @Transient
    public Integer getStart() {
        return start;
    }

    public void setStart(Integer start) {
        this.start = start;
    }

    @Transient
    public String getOrderBy() {
        return orderBy;
    }

    public void setOrderBy(String orderBy) {
        this.orderBy = orderBy;
    }
}
